Wasmtime's C API
For more information you can find the documentation for this library online.
Using in a C Project
To use Wasmtime from a C or C++ project, you can use Cargo to build the Wasmtime C bindings. From the root of the Wasmtime repository, run the following command:
cargo build --release wasmtime-c-api
This will create static and dynamic libraries called libwasmtime
in the target/release
directory.
Using in a Rust Project
If you have a Rust crate that contains bindings to a C or C++ library that uses Wasmtime, you can link the Wasmtime C API using Cargo.
- Add a dependency on the
wasmtime-c-api-impl
crate to yourCargo.toml
. Note that package name differs from the library name.
[]
= { = "16.0.0", = "wasmtime-c-api-impl" }
- In your
build.rs
file, when compiling your C/C++ source code, add the Cwasmtime-c-api
headers to the include path: